﻿namespace FSLib

type FilterSilverAvg() =
    interface IFilter2D with

        member this.FilterName = "SilverAvg"
        member this.Description = "モノクロ化（RGB平均値）"

        member this.Compute mat:int[,] =

            let avg col =
                let (r,g,b) = CommonUtils.toRGBF(col)
                let y = int(List.average[r;g;b])
                CommonUtils.toValue(y,y,y)

            Array2D.map avg mat

